//
//  ZCInvolvedDetailsModelHotSponsors.m
//
//  Created by   on 16/3/28
//  Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//

#import "ZCInvolvedDetailsModelHotSponsors.h"


NSString *const kZCInvolvedDetailsModelHotSponsorsStatus = @"status";
NSString *const kZCInvolvedDetailsModelHotSponsorsPaytime = @"paytime";
NSString *const kZCInvolvedDetailsModelHotSponsorsAvatar = @"avatar";
NSString *const kZCInvolvedDetailsModelHotSponsorsId = @"id";
NSString *const kZCInvolvedDetailsModelHotSponsorsMid = @"mid";
NSString *const kZCInvolvedDetailsModelHotSponsorsUsername = @"username";
NSString *const kZCInvolvedDetailsModelHotSponsorsPaytype = @"paytype";
NSString *const kZCInvolvedDetailsModelHotSponsorsFid = @"fid";
NSString *const kZCInvolvedDetailsModelHotSponsorsType = @"type";
NSString *const kZCInvolvedDetailsModelHotSponsorsMoney = @"money";
NSString *const kZCInvolvedDetailsModelHotSponsorsRpId = @"rp_id";


@interface ZCInvolvedDetailsModelHotSponsors ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;

@end

@implementation ZCInvolvedDetailsModelHotSponsors

@synthesize status = _status;
@synthesize paytime = _paytime;
@synthesize avatar = _avatar;
@synthesize hotSponsorsIdentifier = _hotSponsorsIdentifier;
@synthesize mid = _mid;
@synthesize username = _username;
@synthesize paytype = _paytype;
@synthesize fid = _fid;
@synthesize type = _type;
@synthesize money = _money;
@synthesize rpId = _rpId;


+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}

- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];
    
    // This check serves to make sure that a non-NSDictionary object
    // passed into the model class doesn't break the parsing.
    if(self && [dict isKindOfClass:[NSDictionary class]]) {
            self.status = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsStatus fromDictionary:dict];
            self.paytime = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsPaytime fromDictionary:dict];
            self.avatar = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsAvatar fromDictionary:dict];
            self.hotSponsorsIdentifier = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsId fromDictionary:dict];
            self.mid = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsMid fromDictionary:dict];
            self.username = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsUsername fromDictionary:dict];
            self.paytype = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsPaytype fromDictionary:dict];
            self.fid = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsFid fromDictionary:dict];
            self.type = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsType fromDictionary:dict];
            self.money = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsMoney fromDictionary:dict];
            self.rpId = [self objectOrNilForKey:kZCInvolvedDetailsModelHotSponsorsRpId fromDictionary:dict];

    }
    
    return self;
    
}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:self.status forKey:kZCInvolvedDetailsModelHotSponsorsStatus];
    [mutableDict setValue:self.paytime forKey:kZCInvolvedDetailsModelHotSponsorsPaytime];
    [mutableDict setValue:self.avatar forKey:kZCInvolvedDetailsModelHotSponsorsAvatar];
    [mutableDict setValue:self.hotSponsorsIdentifier forKey:kZCInvolvedDetailsModelHotSponsorsId];
    [mutableDict setValue:self.mid forKey:kZCInvolvedDetailsModelHotSponsorsMid];
    [mutableDict setValue:self.username forKey:kZCInvolvedDetailsModelHotSponsorsUsername];
    [mutableDict setValue:self.paytype forKey:kZCInvolvedDetailsModelHotSponsorsPaytype];
    [mutableDict setValue:self.fid forKey:kZCInvolvedDetailsModelHotSponsorsFid];
    [mutableDict setValue:self.type forKey:kZCInvolvedDetailsModelHotSponsorsType];
    [mutableDict setValue:self.money forKey:kZCInvolvedDetailsModelHotSponsorsMoney];
    [mutableDict setValue:self.rpId forKey:kZCInvolvedDetailsModelHotSponsorsRpId];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (NSString *)description 
{
    return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}

#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:aKey];
    return [object isEqual:[NSNull null]] ? nil : object;
}


#pragma mark - NSCoding Methods

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    self.status = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsStatus];
    self.paytime = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsPaytime];
    self.avatar = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsAvatar];
    self.hotSponsorsIdentifier = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsId];
    self.mid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsMid];
    self.username = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsUsername];
    self.paytype = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsPaytype];
    self.fid = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsFid];
    self.type = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsType];
    self.money = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsMoney];
    self.rpId = [aDecoder decodeObjectForKey:kZCInvolvedDetailsModelHotSponsorsRpId];
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{

    [aCoder encodeObject:_status forKey:kZCInvolvedDetailsModelHotSponsorsStatus];
    [aCoder encodeObject:_paytime forKey:kZCInvolvedDetailsModelHotSponsorsPaytime];
    [aCoder encodeObject:_avatar forKey:kZCInvolvedDetailsModelHotSponsorsAvatar];
    [aCoder encodeObject:_hotSponsorsIdentifier forKey:kZCInvolvedDetailsModelHotSponsorsId];
    [aCoder encodeObject:_mid forKey:kZCInvolvedDetailsModelHotSponsorsMid];
    [aCoder encodeObject:_username forKey:kZCInvolvedDetailsModelHotSponsorsUsername];
    [aCoder encodeObject:_paytype forKey:kZCInvolvedDetailsModelHotSponsorsPaytype];
    [aCoder encodeObject:_fid forKey:kZCInvolvedDetailsModelHotSponsorsFid];
    [aCoder encodeObject:_type forKey:kZCInvolvedDetailsModelHotSponsorsType];
    [aCoder encodeObject:_money forKey:kZCInvolvedDetailsModelHotSponsorsMoney];
    [aCoder encodeObject:_rpId forKey:kZCInvolvedDetailsModelHotSponsorsRpId];
}

- (id)copyWithZone:(NSZone *)zone
{
    ZCInvolvedDetailsModelHotSponsors *copy = [[ZCInvolvedDetailsModelHotSponsors alloc] init];
    
    if (copy) {

        copy.status = [self.status copyWithZone:zone];
        copy.paytime = [self.paytime copyWithZone:zone];
        copy.avatar = [self.avatar copyWithZone:zone];
        copy.hotSponsorsIdentifier = [self.hotSponsorsIdentifier copyWithZone:zone];
        copy.mid = [self.mid copyWithZone:zone];
        copy.username = [self.username copyWithZone:zone];
        copy.paytype = [self.paytype copyWithZone:zone];
        copy.fid = [self.fid copyWithZone:zone];
        copy.type = [self.type copyWithZone:zone];
        copy.money = [self.money copyWithZone:zone];
        copy.rpId = [self.rpId copyWithZone:zone];
    }
    
    return copy;
}


@end
